package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.RecordBean;
import com.project.mapper.IRecordMapper;
import com.project.service.IRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

@Service
@Transactional
public class RecordServiceImpl implements IRecordService {
    public int pageSize = 3;
    @Autowired
    private IRecordMapper mapper;

    @Override
    public PageInfo<RecordBean> findByDate(int pageNO, LocalDate startDate, LocalDate endDate) {
        PageHelper.startPage(pageNO,pageSize);
        PageInfo<RecordBean> pageInfo = PageInfo.of(mapper.findByDate(startDate,endDate));
        return pageInfo;
    }
}
